<div class="user_head_info">
    <div class="user_ava"> 
        <?php if($user['avatar']) : ?>
        <img src="/images/uploads/userAvatars/<?php echo $user['avatar']; ?>" style="width:30px; height: 30px;"/>
        <?php else : ?>
        <img src="/images/prettyImg/default-avatarl.jpg" width="45px" alt="" />
        <?php endif; ?>
    </div>    
    <span class="profile_username"><?php echo $user['displayName']; ?></span><br/>
   <span class="last_login">Последний раз был   <?php echo Yii::app()->dateFormatter->format("dd MMMM в HH:mm", Yii::app()->user->getState('logDate')); ?></span> 
  
</div>


<?php $this->renderPartial('//partials/userMenu', array('userName'=>$user['login'], 'countNewComments'=>$this->countNewComments['count'], 'countNewMessages'=>$this->countNewMessages['count'],'curent'=>'reviews')); ?>

<div class="padding040">

<h2 class="profil_h2">Свежие отзывы</h2>
<?php if(!empty($reviews)) : ?>
    <?php for($i=0, $j=0; $i<count($reviews); $i++, $j++) : ?>
        <?php $paramsArr = array('url'=>$reviews[$i]['url'], 'partnerUrl'=>$reviews[$i]['partnerUrl'], 'catId'=>$reviews[$i]['catId']) ; ?>

        <?php if(!Yii::app()->user->isGuest && $_GET['login'] == Yii::app()->user->getState('login') && $reviews[$i]['status'] == 'Отклонен') : ?>
            <span style="float: right"><a href="<?php echo $this->options[3]['val']; ?>">Отзыв удален</a></span>
        <?php endif; ?>

        <?php if($reviews[$i]['status'] == 'Сомнительный') : ?>
            <span style="float: right"><a href="<?php echo $this->options[3]['val']; ?>">Сомнительный отзыв</a></span>
        <?php endif; ?>

        <?php echo $reviews[$i]['catName'].' | '.$reviews[$i]['name']; ?> 

        <?php if(!empty($reviews[$i]['subCats'])) : ?>
            <?php for($l=0; $l<count($reviews[$i]['subCats']); $l++) : ?>
                <span style="background-color:<?php echo Yii::app()->params['colors'][$l%10]; ?>">
                    <a href="<?php echo Yii::app()->createUrl('partner/default/cat', array('catId'=>$reviews[$i]['subCats'][$l]['catId'], 'parentId'=>$reviews[$i]['subCats'][$l]['parentId'])); ?>"> <?php echo $reviews[$i]['subCats'][$l]['name']; ?> </a>
                </span>&nbsp;
            <?php endfor; ?>
        <?php endif; ?>    
            
        <br/>
        
        <div class="reviews_cut"></div>
        <?php 
            if($reviews[$i]['averageRating'] < 5) $color = 'red';
            else if($reviews[$i]['averageRating'] < 8) $color = 'gray';
            else $color = '#E3F4CD';
        ?>
        <div class="profil_reviews" style="background-color: <?php echo $color; ?>">
            <div class="reviews_date"><?php echo Yii::app()->dateFormatter->format("dd MMMM yyyy года в HH:mm", $reviews[$i]['date']); ?></div>
            <?php if(!empty($reviews[$i]['title'])) : ?>
                <a href="<?php echo Yii::app()->createUrl('partner/profile/review', $paramsArr);?>"><?php echo mb_strlen($reviews[$i]['title'], 'utf-8') > 30 ? mb_substr($reviews[$i]['title'], 0, 30, 'utf-8').'...' : $reviews[$i]['title'] ; ?></a>
            <?php else : ?>
                <a href="<?php echo Yii::app()->createUrl('partner/profile/review', $paramsArr);?>">...</a>
            <?php endif; ?>
            <?php $text = mb_strlen($reviews[$i]['text'], 'utf-8') > 200 ? mb_substr($reviews[$i]['text'], 0, 200, 'utf-8').'...' : $reviews[$i]['text']; ?>    
            <script LANGUAGE="JavaScript">document.write('<?php echo CPartnerkiHelper::jsString($text); ?>');</script> 
            <br/>
            <a href="<?php echo Yii::app()->createUrl('partner/profile/review', $paramsArr);?>">Читать дальше</a>&nbsp;

            <?php if($reviews[$i]['countComments']) : ?>
                <?php echo $reviews[$i]['countComments']; ?> 
                <?php if($reviews[$i]['countNewCom']) : ?>
                    <span class="comments_green">
                        + <?php echo $reviews[$i]['countNewCom']; ?> 
                    </span>
                <?php endif; ?>    
                коментари<?php echo CPartnerkiHelper::getEndCom($reviews[$i]['countNewCom'] ? $reviews[$i]['countNewCom'] : $reviews[$i]['countComments']); ?>
            <?php else : ?>    
                коментариев нет
            <?php endif; ?>
        </div> <hr/><br/>
    <?php endfor; ?>
<?php else : ?>
 <p align="center">  Пользователь пока не оставил ни одного отзыва</p>
<?php endif; ?>

<div class="pages">
    <?php $this->widget('CLinkPager', array('pages' => $pagination)); ?> 
</div>  

</div>